package com.xkdx.caipiao.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class IsMobileNum {
	private static String cmcc;
	private static String cdma;
	private static String wcdma;

	public static boolean isMobileNum(String mobiles) {
		Pattern p = Pattern
				.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
		Matcher m = p.matcher(mobiles);
		return m.matches();

	}

	public static String isMobileInfo(String mobiles) {
		cmcc = "^1(34[0-8]|(3[5-9]|47|5[0-2]|57[124]|5[89]|8[2378])\\d)\\d{7}$";
		cdma = "^1(3[0-2]|45|5[56]|8[56])\\d{8}$";
		wcdma = "^1(33|53|8[09])\\d{8}$";
		Pattern p = Pattern.compile(cmcc);
		Pattern q = Pattern.compile(cdma);
		Pattern w = Pattern.compile(wcdma);

		Matcher m = p.matcher(mobiles);
		Matcher n = q.matcher(mobiles);
		Matcher f = w.matcher(mobiles);
		String cmcc = "移动";
		String cdma = "联通";
		String wcdma = "电信";
		if (m.matches() == true) {
			return cmcc;
		} else if (n.matches() == true) {
			return cdma;
		} else {
			return wcdma;
		}
	}
}
